package com.expert.miniapp.dto;

import com.expert.miniapp.dao.RecommendationItem;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * RecommendationResponseDTO - 推荐结果响应DTO
 *
 * 返回给前端的完整推荐结果结构
 *
 * @author System
 * @since 2025-10-31
 */
@Data
public class RecommendationResponseDTO {

    /**
     * 推荐ID
     */
    private String recommendationId;

    /**
     * 需求ID
     */
    private String demandId;

    /**
     * 匹配到的资源总数量
     */
    private Integer totalCount;

    /**
     * 各类资源数量统计
     */
    private ResourceStatistics statistics;

    /**
     * 推荐明细列表（按rank_order排序）
     */
    private List<RecommendationItem> items;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    /**
     * ResourceStatistics内部类 - 资源统计信息
     */
    @Data
    public static class ResourceStatistics {

        /**
         * 科研专家数量
         */
        private Integer matchedExpertCount;

        /**
         * 科技成果数量
         */
        private Integer matchedAchievementCount;

        /**
         * 仪器设备数量
         */
        private Integer matchedInstrumentCount;

        /**
         * 实验室数量
         */
        private Integer matchedLaboratoryCount;

        /**
         * 其他资源数量
         */
        private Integer matchedOtherCount;

        /**
         * 便捷构造方法
         */
        public ResourceStatistics(Integer expert, Integer achievement, Integer instrument,
                                  Integer laboratory, Integer other) {
            this.matchedExpertCount = expert;
            this.matchedAchievementCount = achievement;
            this.matchedInstrumentCount = instrument;
            this.matchedLaboratoryCount = laboratory;
            this.matchedOtherCount = other;
        }

        /**
         * 无参构造方法
         */
        public ResourceStatistics() {
            this.matchedExpertCount = 0;
            this.matchedAchievementCount = 0;
            this.matchedInstrumentCount = 0;
            this.matchedLaboratoryCount = 0;
            this.matchedOtherCount = 0;
        }
    }
}
